#ifndef WXSEXTRESMANAGER_H
#define WXSEXTRESMANAGER_H

#include <wx/hashmap.h>
#include <wx/treectrl.h>

#include "wxsresource.h"


class wxsExtResManager {
  public:


    bool CanOpen( const wxString& FileName );


    bool Open( const wxString& FileName );


    static wxsExtResManager* Get() { return &m_Singleton; }


    void DeleteAll();

  private:

    WX_DECLARE_STRING_HASH_MAP( wxsResource*, FilesMapT );
    typedef FilesMapT::iterator FilesMapI;

    FilesMapT m_Files;                        ///< \brief Map of opened files
    bool      m_ClosingAll;                   ///< \brief Set to true when closing all resources
    static wxsExtResManager m_Singleton;

    void EditorClosed( wxsResource* Res );


    wxsExtResManager();


    ~wxsExtResManager();

    // Allow calling EditorClosed from wxsResource
    friend class wxsResource;
};


inline wxsExtResManager* wxsExtRes() { return wxsExtResManager::Get(); }

#endif
